

import React, { Component } from 'react'
import axios from 'axios'
export default class App extends Component {
    constructor(){
        super()
        axios.get('/test.json').then(res=>{
            console.log(res.data.data.films);
            this.setState({
                films:res.data.data.films
            })
        })
    }
    state={
        films:[]
    }
  render() {
    return (
      <div>
        {
            this.state.films.map(item=>
                <Films key={item.filmId} {...item}/>
            )
        }
      </div>
    )
  }
}

class Films extends Component{
    render() {
        let {name,poster}=this.props
        return (
          <div>
            <img src={poster}/>
            {name}
          </div>
        )
      }
}